home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pas_all.zip / TI674.ASC < prev    next >
Text File  |  1992-08-12  |  2KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Turbo Pascal                           NUMBER  :  674
  9.   VERSION  :  6.0
  10.        OS  :  MS/PC DOS
  11.      DATE  :  August 12, 1992                          PAGE  :  1/2
  12.  
  13.     TITLE  :  Change Foreground and Background Color
  14.  
  15.  
  16.  
  17.  
  18.   {
  19.  
  20.   This program will place a new foreground and background color and
  21.   pattern on the desktop.  It will also set the character that is
  22.   displayed for the pattern.
  23.  
  24.   This example: the $05 defines the 0 for black foreground and
  25.   the 5 for purple background.
  26.  
  27.   }
  28.  
  29.   program ColorManipulation;
  30.  
  31.   uses
  32.       Dos, Objects, Drivers, Memory, Views,
  33.       Menus, Dialogs, App;
  34.   type
  35.     PMyBack = ^TMyBack;
  36.     TMyBack = object(TBackground)
  37.       constructor Init(var Bounds: TRect);
  38.     end;
  39.  
  40.     PMyApp = ^TMyApp;
  41.     TMyApp = object(TApplication)
  42.       MyBack: PMyBack;
  43.       constructor Init;
  44.       function GetPalette:PPalette; virtual;
  45.     end;
  46.  
  47.   function TMyApp.GetPalette: PPalette;
  48.   const
  49.     MyBackColor : TPalette = CColor;  { sets palette to CColor }
  50.                                       { items }
  51.   begin
  52.     MyBackColor[1]:=#$05;   { TBackGround Color Constant's first }
  53.                             { number is background and second is }
  54.                             { foreground }
  55.     GetPalette := @MyBackColor;
  56.   end;
  57.  
  58.   constructor TMyBack.Init(var Bounds: TRect);
  59.   begin
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Turbo Pascal                           NUMBER  :  674
  75.   VERSION  :  6.0
  76.        OS  :  MS/PC DOS
  77.      DATE  :  August 12, 1992                          PAGE  :  2/2
  78.  
  79.     TITLE  :  Change Foreground and Background Color
  80.  
  81.  
  82.  
  83.  
  84.     TBackground.Init(Bounds, '▓');{ places ASCII 178 char as    }
  85.                                   { pattern for text on desktop }
  86.   end;
  87.  
  88.   constructor TMyApp.Init;
  89.   var
  90.     R:TRect;
  91.   begin
  92.     TApplication.Init;
  93.     GetExtent(R);
  94.     MyBack:= New(PMyBack, init(R));
  95.     Desktop^.Background:= MyBack;
  96.     Desktop^.Insert(Desktop^.Background);
  97.   end;
  98.  
  99.   var
  100.     TheApp: TMyApp;
  101.   begin
  102.     TheApp.Init;
  103.     TheApp.Run;
  104.     TheApp.Done;
  105.   end.
  106.  
  107.   DISCLAIMER: You have the right to use this technical information
  108.   subject to the terms of the No-Nonsense License Statement that
  109.   you received with the Borland product to which this information
  110.   pertains.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.